package com.three.Service.ServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.three.Mapper.ClassMapper;
import com.three.Pojo.Classes;
import com.three.Service.IClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassServiceImpl implements IClassService {
    @Autowired
    private ClassMapper classMapper;

    @Override
    public void addsave(Classes clas) {
        classMapper.addsave(clas);
    }

    @Override
    public PageInfo<Classes> findlist(Integer pageNum, Integer pageSize, String className) {
        PageHelper.startPage(pageNum,pageSize);
        List<Classes> classesList =classMapper.findclasslist(className);
        PageInfo<Classes> pageInfo=new PageInfo<>(classesList);
        return pageInfo;
    }

    @Override
    public Classes findByid(Integer id) {
        return classMapper.findByid(id);
    }

    @Override
    public void updatesave(Classes clas) {
        classMapper.updatesave(clas);
    }

    @Override
    public void delete(Integer id) {
        classMapper.delete(id);
    }


}
